Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Merge Subkey into sc-cli #4954

Merged
111 commits merged into from
Aug 20, 2020
Merged

Merge Subkey into sc-cli #4954

111 commits merged into from
Aug 20, 2020

Conversation

seunlanlege
Copy link
Contributor

@seunlanlege seunlanlege commented Feb 17, 2020

see #4416

@seunlanlege seunlanlege added A3-in_progress Pull request is in progress. No review needed at this stage. B1-clientnoteworthy labels Feb 17, 2020
@parity-cla-bot
Copy link

It looks like @seunlanlege signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

@seunlanlege
Copy link
Contributor Author

blocked on #4842

@joepetrowski
Copy link
Contributor

What is the motivation for this change? Would be nice to have a write up either here or in an issue.

@NikVolf
Copy link
Contributor

NikVolf commented Feb 22, 2020

What is the motivation for this change? Would be nice to have a write up either here or in an issue.

#4416

@cecton
Copy link
Contributor

cecton commented Feb 24, 2020

#4842 has been merged. Updating this PR is going to be fun 😁 call me if you need any help @seunlanlege

client/cli/src/arg_enums.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@cecton cecton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes

client/cli/src/commands/runcmd.rs Outdated Show resolved Hide resolved
client/cli/src/arg_enums.rs Outdated Show resolved Hide resolved
@seunlanlege seunlanlege marked this pull request as ready for review March 18, 2020 07:40
@seunlanlege seunlanlege added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Mar 18, 2020
bkchr
bkchr previously requested changes Aug 10, 2020
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I now complained 2 times (this being the third time) that the SharedParams is added by all the cli commands. I understand that this is a current requirement of the API, however this needs to be changed if this pr should be merged.

The following command makes no sense:

cargo run -p node-cli -- verify --dev SIGNATURE

And there are also other cli commands that follow this schema.

A CLI command should never require arguments that are useless for the given command.

Comment on lines +85 to +87
.map_err(|e| Error::Other(format!("{:?}", e)))?;

Ok(())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.map_err(|e| Error::Other(format!("{:?}", e)))?;
Ok(())
.map_err(|e| Error::Other(format!("{:?}", e)).into())

@@ -0,0 +1,5 @@
scrape_configs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

@seunlanlege
Copy link
Contributor Author

SharedParams is added by all the CLI commands.

Heyyyyy sorry about this, my strategy for removing unused-SharedParams is by removing the CliConfiguration implementation, it somehow skipped my mind to do the same for sign, verify and vanity.

bin/node/cli/Cargo.toml Outdated Show resolved Hide resolved
client/cli/src/commands/verify.rs Outdated Show resolved Hide resolved
utils/frame/frame-utilities-cli/src/module_id.rs Outdated Show resolved Hide resolved

use crate::{Error, NetworkSchemeFlag};
use std::fs;
use libp2p::identity::{PublicKey, ed25519};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious as to why we're using ed25519 specific types from libp2p.

pub fn run(&self) -> Result<(), Error> {
let mut file_content = hex::decode(fs::read(&self.file)?)
.map_err(|_| "failed to decode secret as hex")?;
let secret = ed25519::SecretKey::from_bytes(&mut file_content)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this command only usable for ed25519? would it make sense to generalize this so that i can also get the public key from an sr25519 file for example? I saw the CryptoScheme earlier and i think it can be used here to receive an additional argument for the crypto scheme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for now, we only support ed25519, see

arg_enum! {
#[allow(missing_docs)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum NodeKeyType {
Ed25519
}
}

use super::{SignCmd, VanityCmd};
use structopt::StructOpt;

#[test]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you take each of these 2 tests into their respective command modules?

assert!(sign.run().is_ok());
}

#[test]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor

@rakanalh rakanalh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gnunicorn
Copy link
Contributor

@gnunicorn
Copy link
Contributor

bot merge

@ghost
Copy link

ghost commented Aug 20, 2020

Trying merge.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.